#include<bits/stdc++.h>
template <typename T> inline void read(T &x) {
    x = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch) && ch ^ '-') ch = getchar();
    if (ch == '-') f = -1, ch = getchar();
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); x *= f;
}
using namespace std;
const int N=1e6+5,M=2e6+5;
int n,e,head[N],to[M],nxt[M],d[N],fa[N],ans[N];
priority_queue<int> q;
void add_edge(int x,int y)
{
	to[++e]=y;
	nxt[e]=head[x];
	head[x]=e;
}
void dfs(int p,int f)
{
	fa[p]=f;
	for(int a=head[p];a>0;a=nxt[a])
	{
		int s=to[a];
		if(s==f) continue;
		dfs(s,p);
		d[p]++;
	}
}
int main()
{
	freopen("choice.in","r",stdin);
	freopen("choice.out","w",stdout);
    read(n);
    for(int a=1;a<n;a++)
    {
    	int x,y;
    	read(x),read(y);
    	add_edge(x,y);
    	add_edge(y,x);
	}
	dfs(1,0);
	for(int a=1;a<=n;a++)
	{
		if(d[a]==0) q.push(a);
	}
	while(!q.empty())
	{
		int t=q.top();
		q.pop();
		ans[++ans[0]]=t;
		if(fa[t]>0)
		{
	     	d[fa[t]]--;
	     	if(d[fa[t]]==0) q.push(fa[t]);
		}
	}
	for(int a=n;a>=1;a--) printf("%d ",ans[a]);
}
